package com.learn.thread;

/**
 * 线程插队
 */
public class TestThreadJoin implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println(">>>>>>>>>>>子线程Viper"+i);
        }
    }

    public static void main(String[] args) {

        Thread threadSub = new Thread(new TestThreadJoin());
        threadSub.start();
        for (int i = 0; i < 100; i++) {
            if(i==50){
                try {
                    threadSub.join();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println(">>>>>>>>>>>主线程"+i);
        }
    }
}
